package string;

/**
 *int indexOf(String str)
 * 检索字符串在当前字符串中第一次出现的位置
 */
public class IndexOfDemo {
    public static void main(String[] args) {
        String str="thinking in java";
        int index=str.indexOf("in");
        System.out.println(index);
         index=str.indexOf("in",4);
         System.out.println(index);
         index =str.indexOf("abd");
         System.out.println(index);
         index =str.lastIndexOf("j");
         System.out.println(index);
         index =str.lastIndexOf("a");
         System.out.println(index);
         index =str.length();
        System.out.println(index);
    }
}
